//
// Created by LiuYou on 2021/10/31.
//

#ifndef LINUXENVIRONMENTPROGRAMMING2_MYSEMAPHORE_HPP
#define LINUXENVIRONMENTPROGRAMMING2_MYSEMAPHORE_HPP


class MySemaphore {
public:
    typedef void MySem;
public:
    static MySem* init(int initVal);

    /*
     * 归还资源。
     */
    static int returnResources(MySem* mySem, int resources);

    /*
     * 请求资源
     */
    static int requestResource(MySem* mySem, int resources);


    static int destroy(MySem* mySem);
};


#endif //LINUXENVIRONMENTPROGRAMMING2_MYSEMAPHORE_HPP
